#include <iostream>  
#include <ctime>   
#include <sys/types.h>    
#include <sys/stat.h>     
using namespace std;     
int  main ()  
{  
    struct stat buf;    
    int result;    
    result = stat ("abc.txt", &buf);    
    if (result != 0)  
      {  
          perror ("Failed ^_^");  
      }  
    else  
      {    
          //! 文件的大小，字节为单位    
          cout << "size of the file in bytes: " << buf.st_size << endl;    
          //! 文件创建的时间    
          cout << "time of creation of the file: " << ctime (&buf.st_ctime) << endl;   
          //! 最近一次修改的时间    
          cout << "time of last modification of the file: " << ctime (&buf.st_mtime) << endl;    
          //! 最近一次访问的时间    
          cout << "time of last access of the file: " << ctime (&buf.st_atime)<< endl;  
      }    
    return 0;    
} 